1. Field of the Invention
This invention relates generally to improvements in microprocessors and in particular to apparatus and a method for switching the operating mode of a microprocessor to allow a more efficient use of the machine.
2. Description of the Prior Art
Microprocessors are defined as the physical realization of the central processing unit of a computr system on either a single chip of semiconductor or a small number of chips, (New Penguin Dictionary of Electronics, 1979). Microprocessors usually consist of an arithmetic and logic unit, a control unit and a memory unit. Microprocessors are characterized by speed, word length, architecture and instruction set, which may be either fixed or microprogrammed. The combination of these characteristics determines the performance of the processor.
Most microprocessors have a fixed instruction set. Microprogrammed processors have a control store containing the microcode or firmware that defines the processor's instruction set; such processors may either be implemented on a single chip or constructed from bit-slice elements.
The processor's architecture determines what register, stack and I/O facilities are available, as well as defining the processor's primitive data types and how addresses are derived from its registers. The data types, which are the fundamental entities that can be manipulated by the instruction set, typically include bit, nibble (4 bits), byte (8 bits), word (16 bits), and on the latest microprocessors, double words (32 bits). A word is usually defined as the number of bits in the processor's internal data bus rather than always being 16 bits. Instructions generally include arithmetic logical, flow-of-control, and data movement (between stacks, registers, memory, and I/O ports).
The first microprocessor, the four-chip set Intel 4004, appeared in 1971.
It was a calculator that could implement a simple set of instructions in hardware but permitted complex sequences of them to be stored in a read-only memory (ROM). It has a four-chip set consisting of a CPU, ROM, RAM, and a shift-register chip. The Intel 4004 had a 4-bit data bus, could address 4.5K bytes of memory, and had 45 instructions. Its 8-bit counterpart, the Intel 8008, was introduced in 1974 and its improved derivative, the Zilog Z-80, in 1976.
Current microprocessors include the Zilog Z8000, Motorola 68000, Intel 8086, National 16000, as well as the older Texas Instruments 9900 and Digital Equipment Corporation LSI-11. All of these chips use a 16-bit-wide external data bus. Still higher performance microprocessors using 32-bit external data busses are now beginning to appear.
An article in the IBM Journal of Research and Development, Vol. 29, No. 2, March 1985 entitled "Microprocessors in Brief", by Robert C. Stanley, gives an overview of the past, present, and future of microprocessors and describes the key elements of their structure and operation.
One of the problems that has arisen through the development of families of microprocessors is maintaining compatibility between succeeding generations so that programs developed to run on earlier machines are also able to run on later processors while, at the same time, new programs are able to make use of extended features, such as larger memory capacity.
An example of this problem is found in the IBM Personal Computer (IBM PC) and compatible machines. (IBM is a Registered Trademark). The original IBM PC used the Intel 8088 processor and had a random access memory (RAM) of 640K bytes. A recent version of the IBM PC, the PC/At, uses the more powerful Intel 80286 microprocessor and can have up to 14.6M bytes of RAM.
The 80286 has the same instruction set as the 8088 with some extensions, and has two modes of operation, `real` mode and `protected` mode. The modes define the method of deriving addresses from the contents of registers. In real mode addresses are derived in exactly the same way as is used in the 8088 with the result that programs written for the 8088 will work on the 80286 in real mode, but with no access to the additional memory.
In protected mode a different method of deriving addresses is used which allows access to all memory of the machine, but unfortunately prevents programs not specifically designed to operate on the processor in protected mode from working.
It may be noted here that other methods of increasing the addressing capability of a microprocessor have been devised. For example, as reported in PC WEEK, 30 Apr. 1985, Intel and Lotus are making available for the IBM PC a special memory card with up to 4 Meg of memory utilizing `bank switching`, and Lotus is providing special versions of its software that exploit the additional memory. This method has the advantage that it can be used on existing PCs but it too appears to require programs to be changed to exploit the additional memory.
It is of course possible to modify programs so that they will run in protected mode, and many programs will be so modified. However, while popular application programs have not been modified the computer system must be able to run these modified programs; in other words it must be possible to switch modes.
The 80286 provides an instruction to switch from real to protect mode, but does not provide an instruction to switch back.
Therefore to switch from protected to real mode requires circuitry external to the 80286 to cause a reset of the 80286.
Reset of a microprocessor is caused by applying a pulse to its RESET input. The microprocessor clears all its internal registers and begins to fetch instructions from a fixed address. This address will usually be a Read-only Memory of the computer system and will contain the first instruction of the power on routine which checks out the basic operation of the processor and other parts of the computer system. When the computer is first turned on, external circuitry generates a RESET pulse for the microprocessor after all power levels are stable.
The IBM Personal Computer AT uses reset for mode switching, and incorporates
a. circuits to trigger the RESET pulse from a program PA1 b. circuits to register the fact that the RESET is for the purpose of mode switch, so that after some amount of testing has been performed, the processor can determine whether to proceed with checkout and then initialize the system or whether to complete a mode switch. PA1 c. a routing in ROM which obtains control immediately after RESET and does the following:
1. performs the basic testing of the microprocessor PA2 2. tests the modes switch register (b). If not set, continues with normal power-on sequence, Else . . . PA2 3. determines the address of the modeswitch routine in RAM PA2 4. branches to the modeswitch routine
(Step 1 here takes considerable time and is unnecessary when mode switching, so it might be suggested that this routine could be improved by reversing the order of steps 1 and 2. This would be considered poor practice in modern computer systems because an error that would cause a diagnostic check in step 1 may lead to an invalid outcome of step 2.)